<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="renderer" content="webkit">
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta name="author" content="tyler chao">
  <meta name="keywords" content="keywords">
  <meta name="description" content="description">
  <title>供货管理</title>
  <link rel="stylesheet" href="<{$env.app.res_url}>/css/mobile.min.css">
  <link rel="stylesheet" href="<{$env.app.res_url}>/css/main.min.css">
</head>
<body>
<header class="fixed">
  <div class="top-bar" data-topbar>
    <div class="pos-left">
      <a href="javascript:history.back();" class="icon-arrow-back"></a>
    </div>
    <h1>供货管理</h1>
    <div class="pos-right"><a href="" class="icon-refresh"></a></div>
  </div>
</header>
<main id="main" class="container no-margin">
  <div class="top-bar reverse">
    <form action="<{$link_url}>" method="post" class="row blank">
      <div class="grid-2 columns">
        <select name="sel_type" id="sel_type">
          <option value="item_bn">货号</option>
          <option value="item_name">名称</option>
        </select>
      </div>
      <div class="grid-10 columns">
        <input type="search" name="sel_keywords" id="sel_keywords" placeholder="请输入关键词搜索">
      </div>
    </form>
  </div>
    <ul class="bar-tabs">
        <{foreach from=$sub_menu item=rs}>
            <li class="controller <{if $rs.curr_view}>active<{/if}>"><a href="<{$rs.href}>"><{$rs.label}></a></li>
        <{/foreach}>
    </ul>
    <div class="tabs-content">
        <{if $dataList}>
        <div class="content active" id="content11">
            <ul class="no-bullet table bordered grid-table">
                <li class="tr">
                    <div class="grid-3 th">货号</div>
                    <div class="grid-7 th">商品名称</div>
                    <div class="grid-1 th">操作</div>
                </li>
                
                <{foreach from=$dataList item=item}>
                <li class="tr">
                    <div class="grid-3 td item_bn"><{$item.material_bn}></div>
                    <div class="grid-7 td item_name"><div class="title" id="item_title_<{$item.bm_id}>" onclick="showTitle('<{$item.bm_id}>')"><{$item.material_name}></div></div>
                    <div class="grid-1 td"><a href="<{$config_url}>?id=<{$item.id}>" class="btn small primary">配置</a></div>
                </li>
                <{/foreach}>
            </ul>
            
            <{if $pageSize > 1}>
            <div class="text-center"><a href="<{$link_url}>" class="act-loadmore" rel="1"><i class="icon-refresh"></i> 点击查看更多商品</a></div>
            <{/if}>
        </div>
        <{else}>
        <div class="no_content" id="content11" style="text-align:center;">没有相关数据...</div>
        <{/if}>
    </div>
</main>

<{include file="store/footer.html"}>
<script>
$('.act-loadmore').on('click', function(e) {
    e.preventDefault();
    var $target = $(e.target);
    var pageSize  = parseInt("<{$pageSize}>");
    var page      = parseInt($target.attr('rel')) + 1;
    
    $.post($target.attr('href'), {'flag': 'ajax', 'page': $target.attr('rel')}, function(rs) {
      if (rs) {
          $target.parent().prev('ul').append(rs);
          $target.html($target.data('text')).attr('rel', +$target.attr('rel') + 1);
          
          if(pageSize <= page)
          {
              $target.parent().html('<span class="text-reverse">没有更多数据了...</span>');
          }
      }
      else {
        $target.parent().html('<span class="text-reverse">没有更多供货了</span>');
      }
    });
});

function showTitle(item_id)
{
    var $this = $("#item_title_"+ item_id);
    $this.css('-webkit-line-clamp', $this.css('-webkit-line-clamp') == 1 ? 'inherit' : '');
}
</script>
</body>
</html>